import 'package:flutter/material.dart';
import 'package:flutter_bmfmap_example/http/http.dart';

class OrderGooditemCard extends StatefulWidget {
  OrderGooditemCard(
      {Key key,
      this.commodityId,
      this.num,
      this.intro,
      this.money,
      this.name,
      this.imgurl1})
      : super(key: key);

  String commodityId;
  String num;
  String intro;
  String name;
  String imgurl1;
  double money;

  @override
  _OrderGooditemCardState createState() => _OrderGooditemCardState();
}

class _OrderGooditemCardState extends State<OrderGooditemCard> {
  @override
  void initState() {
    // TODO: implement initState
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Container(
      // color: Colors.red,
      child: Row(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Container(
            decoration: new BoxDecoration(
              color: Color.fromRGBO(0, 0, 0, 0.04),
              borderRadius: new BorderRadius.circular((8.0)),
            ),
            child: Image.network(
              widget.imgurl1,
              width: 80,
              height: 80,
            ),
          ),
          SizedBox(width: 12),
          Expanded(
            flex: 3,
            child: Column(
              mainAxisAlignment: MainAxisAlignment.spaceAround,
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                SizedBox(
                  height: 12,
                ),
                Container(
                  child: Text(
                    widget.name,
                    softWrap: true,
                    maxLines: 1,
                    overflow: TextOverflow.ellipsis,
                    style: TextStyle(fontSize: 14, color: Color(0xFF313131)),
                  ),
                ),
                Container(
                  // width: 188,
                  child: Text(
                    widget.intro,
                    maxLines: 2,
                    softWrap: true,
                    overflow: TextOverflow.ellipsis,
                    style: TextStyle(fontSize: 12, color: Colors.black54),
                  ),
                ),
              ],
            ),
          ),
          Expanded(
            flex: 1,
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.end,
              children: [
                SizedBox(
                  height: 12,
                ),
                Text(
                  '￥${widget.money}',
                  style: TextStyle(fontSize: 14, color: Colors.black87),
                ),
                Container(
                  margin: EdgeInsets.only(right: 4),
                  padding: EdgeInsets.only(top: 4),
                  child: Text(
                    'x' + widget.num.toString(),
                    style: TextStyle(fontSize: 11, color: Colors.blueGrey[700]),
                  ),
                )
              ],
            ),
          )
        ],
      ),
    );
  }
}
